<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<input type="hidden" name="dateNow" id="dateNow"
			   th:value="${#dates.format(new java.util.Date().getTime(), 'yyyy-MM-dd HH:mm:ss')}"/>
        <form class="form-horizontal m" id="form-orderCj-add">
			<div class="form-group">
				<label class="col-sm-3 control-label">上传文件(养卡消费)：</label>
				<div class="col-sm-8">
					<input id="file" type="file" name="file" class="file-box" accept="application/vnd.ms-excel">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">上传文件(养卡还款)：</label>
				<div class="col-sm-8">
					<input id="file1" type="file" name="file1" class="file-box" accept="application/vnd.ms-excel">
				</div>
			</div>



			<div class="form-group">
				<label class="col-sm-3 control-label">对账时间：</label>
				<div class="col-sm-8">
					<li class="select-time">
						<input type="text"
							   class="time-input" id="uploadTime" placeholder="对账时间"
							   name="uploadTime"/>
					</li>
				</div>
			</div>

		</form>
	</div>
    <div th:include="include::footer"></div>
	<script th:src="@{/ajax/libs/select/select2.js}"></script>
    <script type="text/javascript">
		$(function () {
			$("#uploadTime").val($("#dateNow").val())
		})
		var prefix = ctx + "system/orderGg"
		$("#form-orderCj-add").validate({
			rules:{
				file: {
					required: true,
				},
				uploadTime: {
					required: true,
				},
				file1: {
					required: true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
				var formdata = new FormData();
				formdata.append('file',$('#file').get(0).files[0]);
				formdata.append('file1',$('#file1').get(0).files[0]);
				formdata.append("uploadTime", $("#uploadTime").val());
				formdata.append("type",$("#type option:selected").val());
				$.modal.loading("正在处理中，请稍后...");
				$.ajax({
					url: prefix + "/upload",
					data: formdata,
					type: "post",
					processData: false,
					contentType: false,
					success: function(result) {
						$.operate.saveSuccess(result);
					}
				})
	        }
	    }
	</script>
</body>
</html>
